package com.java.extends_;

/**
 * 继承 - 子类
 */
public class Child extends Parent {
    private Integer name = 3;
    private String child = "child";
    
    public static void main(String[] args) {
        // 父类构造函数不能被继承但可通过super访问
        // Child child = new Child("child", 3);
        
        
        // 父类非私有private成员可被继承
        Child child = new Child();
        // 就近原则
        System.out.println(child.name); // 3
        System.out.println(child.child); // child
        System.out.println(child.parent); // parent
        // System.out.println(child.grand);
        // child.privateFunc();
        child.publicFunc(); // public
        child.finalFunc(); // final
        
        
        // 静态static成员只能通过类名访问而非实例
        // System.out.println(child.staticVar);
        System.out.println(Child.staticVar); // staticParent
        // child.staticFunc();
        Child.staticFunc(); // static
    }
}
